#ifndef COSHIP_AUDIOSDK_H
#define COSHIP_AUDIOSDK_H

#include "CodecId.h"

#ifdef __cplusplus
extern "C" {
#endif

#define DLLSPEC __declspec(dllimport)

//------------ERROR CODE-------------------
#define ADPCMSDK_SUCCESS					0
#define ADPCMSDK_ERROR_BAD_SESSION			-1
#define ADPCMSDK_ERROR_INVALID_PARAM		-2
#define ADPCMSDK_ERROR_WRONG_SESSION_TYPE	-3
#define ADPCMSDK_ERROR_RESOURCE_BUSY		-4
#define ADPCMSDK_ERROR_CREATE_FAILED		-5
#define ADPCMSDK_ERROR_OPERATION_FAILED		-6
#define ADPCMSDK_ERROR_BUFFER_FULL			-7
#define ADPCMSDK_ERROR_BUFFER_TOO_SMALL		-8
#define ADPCMSDK_ERROR_INDEX_OUT_OF_RANGE	-9

typedef int HAUDIOSESSION;
typedef int (__cdecl *CaptureAudioCallBack)(HAUDIOSESSION session, char *data, int len);

DLLSPEC int __cdecl InitializeAudioSDK();
DLLSPEC void __cdecl UninitializeAudioSDK();

DLLSPEC HAUDIOSESSION __cdecl StartPlaybackAudioEx(int channels, int sampleRate, int bitsPerSample, AudioCodecId codecId);

DLLSPEC HAUDIOSESSION __cdecl StartPlaybackAudio(int channels, int sampleRate, int isAdpcmAudio);
DLLSPEC int __cdecl PlaybackAudioData(HAUDIOSESSION session, char *data, int len);
DLLSPEC int __cdecl SetAudioPlaybackVolume(HAUDIOSESSION session, int volume);
DLLSPEC int __cdecl GetAudioPlaybackVolume(HAUDIOSESSION session);
DLLSPEC void __cdecl StopPlaybackAudio(HAUDIOSESSION session);
DLLSPEC void __cdecl PausePlaybackAudio(HAUDIOSESSION session);
DLLSPEC void __cdecl ResumePlaybackAudio(HAUDIOSESSION session);

DLLSPEC int __cdecl GetCaptureDeviceNum();
DLLSPEC int __cdecl GetCaptureDeviceName(int deviceIndex, char *buf, int len);

DLLSPEC HAUDIOSESSION __cdecl StartCaptureAudioEx(int deviceIndex, int channels, int sampleRate, int bitsPerSample,  int bitrate, AudioCodecId codecId, CaptureAudioCallBack callback);

DLLSPEC HAUDIOSESSION __cdecl StartCaptureAudio(int deviceIndex, int channels, int sampleRate, int outputAdpcm, CaptureAudioCallBack callback);
DLLSPEC void __cdecl StopCaptureAudio(HAUDIOSESSION session);
DLLSPEC int __cdecl SetAudioCaptureVolume(HAUDIOSESSION session, int volume);
DLLSPEC int __cdecl GetAudioCaptureVolume(HAUDIOSESSION session);

DLLSPEC HAUDIOSESSION __cdecl StartPlaybackAmrAudio(int isWideBand);
DLLSPEC int __cdecl PlaybackAmrAudioData(HAUDIOSESSION session, char *data, int len);

//amr nb use one of 4.75k, 5.15k, 5.9k, 6.7k, 7.4k, 7.95k, 10.2k or 12.2k
//amr wb use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, 18.25k, 19.85k, 23.05k, or 23.85k
DLLSPEC HAUDIOSESSION __cdecl StartCaptureAmrAudio(int deviceIndex, int isWideBand, int bitrate, CaptureAudioCallBack callback);

#ifdef __cplusplus
}
#endif

#endif
